/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itriage.hospital.client.web.webservices.REST;

import com.itriage.hospital.model.Staff;
import javax.swing.JOptionPane;
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import org.springframework.stereotype.Component;

/**
 *
 * @author TestAccount
 */
@Component
public class ResourceAssembler extends ResourceAssemblerSupport<Staff, StaffResource>{
    
    public ResourceAssembler() {
        super(RESTController.class, StaffResource.class);
    }
 
 
    @Override
    protected StaffResource instantiateResource(Staff staff)
    {
        return new StaffResource(staff);
    }

    @Override
    public StaffResource toResource(Staff t) {
        StaffResource resource = instantiateResource(t);  
        resource.staff = t;
              resource.add(linkTo(RESTController.class).slash(t.getId()).withSelfRel());
        return resource;
    }
}
